<?php
/**
 * Created by PhpStorm.
 * User: qishengqiang
 * Date: 2022-06-02
 * Time: 22:50
 */

namespace app\models;


class Organizations extends ModelBase
{
    protected $pk = 'organizationId';

    public function province()
    {
        return $this->hasOne(Provinces::class, 'provinceCode', 'provinceCode');
    }

    public function getCategoryName()
    {
        if ($this->categoryId == 1) {
            return '学校';
        } elseif ($this->categoryId == 2) {
            return '公益组织';
        }
    }

    public function getStatusText()
    {
        if ($this->status == 1) {
            return '上架';
        } elseif ($this->status == 0) {
            return '下架';
        }
    }

}